<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<title>新增销售价格</title>
		<link rel="stylesheet" type="text/css" href="css/public.css">
		<script type="text/javascript" charSet="UTF-8" src="js/sorttable.js"></script>
		<script language="JavaScript" charSet="UTF-8" src="js/public.js"></script>
		<script type="text/javascript" charSet="UTF-8" src="js/validate.js"></script>
		<script type="text/javascript" charSet="UTF-8" src="js/date1.js"></script>
		<script language="JavaScript"
			src="<%=request.getContextPath()%>/js/salesprice.js" charset="utf-8"></script>
		
		<script type="text/javascript">
		function validate()
		{	
			var customerName = document.getElementById("customerName");
			var materialName = document.getElementById("materialName");
			var bid = document.getElementById("bid");
			var topbid = document.getElementById("topbid");
			var from = document.getElementById("from");
			var to = document.getElementById("to");
			var validDate = document.getElementById("validDate");
			var invalidDate = document.getElementById("invalidDate");
			
			
			//验证凭证字名称代码
			if(!isNotNull(customerName,'客户名称')){
			return false;
			}
			if(!isNotNull(materialName,'物料名称')){
			return false;
			}
			if(!f_check_float(from,'销量从')||!f_check_passwordLength(from,'销量从',1,8)){
			return false;
			}
			if(!f_check_float(to,'销量到')||!f_check_passwordLength(to,'销量到',1,8)){
			return false;
			}
			if(!compareint(from,to,'销售量设置')){
			return false;
			}
			if(!f_check_float(bid,'报价')){
			return false;
			}
			if(!f_check_float(topbid,'最低限价')){
			return false;
			}
			if(!comparemoney(topbid,bid,'最低限价')){
			return false;
			}
			if(!isNotNull(validDate,'生效日期')){
			return false;
			}
			if(!isNotNull(invalidDate,'失效日期')){
			return false;
			}
			if(!interzone(validDate,invalidDate,'周期设置')){
			return false;
			}
			
			
		}
		</script>
		
	</head>

	<body>
		<div id="info_all" style="width: 455px;">
			<div id="info_top">
				新增销售价格
			</div>
			<div style="padding: 4px; width: 450px; margin-top: 6px;">
				<s:form action="editSalesprice.action" method="post" theme="simple" onsubmit=" return validate()">
					<table
						style="margin-top: 10px; background: #fbfbfb; color: #403040;"
						align="center">
						<tr>
							<td width="80px">
								客户名称：
							</td>
							<td>
								
								<s:hidden name="salesprice.customerId" id="customerId"></s:hidden>
								<s:textfield name="salespriceDTO.customer.customerName" id="customerName" size="12" readonly="true"></s:textfield><img src="images/kookup.gif" style="cursor:pointer" onclick="openWin('selectCustomer.action','customer',1050,700,0)">
							</td>
							<td width="80px">
								物料名称：
							</td>
							<td>
								<s:hidden name="salesprice.materialId" id="materialId"></s:hidden>
								<s:textfield name="salespriceDTO.material.materialName" id="materialName" size="12" readonly="true"></s:textfield><img src="images/kookup.gif" style="cursor:pointer" onclick="openWin('materialAction!select.action','material',1050,700,0)">
							</td>
						</tr>
						<tr>
							<td width="80px">
								销售量(从)：
							</td>
							<td>
								<s:hidden name="salesprice.salespriceId" id="salespriceId"></s:hidden>
								<s:textfield name="salesprice.salesNumberFrom" size="12" id="from"></s:textfield>
							</td>
							<td width="100px">
								销售量(到)：
							</td>
							<td>
								<s:textfield name="salesprice.salesNumberTo" size="12" id="to"></s:textfield>
							</td>
						</tr>
						<tr>							
							<td width="100px">
								报价：
							</td>
							<td>
								<s:textfield name="salesprice.bid" size="12" id="bid"></s:textfield>
							</td>
							<td width="100px">
								最低限价：
							</td>
							<td>
								<s:textfield name="salesprice.bottomBid" size="12" id="topbid"></s:textfield>
							</td>
						</tr>
						<tr>							
							<td width="100px">
								生效日期：
							</td>
							<td>
								<s:textfield name="salesprice.validDate" size="12" id="validDate" readonly='true'  cssStyle='cursor: hand'
										onclick="calendar.setHook(this)"></s:textfield>
							</td>
							<td width="100px">
								失效日期：
							</td>
							<td>
								<s:textfield name="salesprice.invalidDate" size="12" id="invalidDate" readonly='true' cssStyle='cursor: hand'
										onclick="calendar.setHook(this)"></s:textfield>
							</td>
						</tr>

						<tr>
							<td></td>
							<td align="center">

								<input type="submit" value="保存" onClick="" onFocus="this.blur()"
									onmouseover="this.className='btnover'"
									onmouseout="this.className='btnout'" class="btnsize" />



							</td>
							<td colspan="2">
								<div style="margin: 6px; text-align: left;">

									<input type="button" value="返回" onClick="window.history.go(-1)"
										onFocus="this.blur()" onmouseover="this.className='btnover'"
										onmouseout="this.className='btnout'" class="btnsize" />
								</div>
							</td>
						</tr>
					</table>
				</s:form>
			</div>
		</div>

	</body>
</html>
